import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

/**
 * 政策新闻类型枚举
 */
export enum PolicyNewsType {
  ADMISSION_DYNAMIC = 1, // 招生动态
  MAJOR_INTRODUCTION = 2 // 专业介绍
}

@Entity('policy_news')
export class PolicyNews {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Column({
    type: 'enum',
    enum: PolicyNewsType,
    comment: '新闻类型'
  })
  type!: PolicyNewsType;

  @Column({
    type: 'varchar',
    length: 200,
    comment: '标题'
  })
  title!: string;

  @Column({
    type: 'text',
    nullable: true,
    comment: '内容（富文本）'
  })
  content!: string;

  @Column({
    type: 'varchar',
    length: 255,
    nullable: true,
    comment: '链接地址'
  })
  linkUrl!: string;

  @Column({
    type: 'varchar',
    length: 50,
    comment: '发布人'
  })
  publisher!: string;

  @Column({
    type: 'timestamp',
    comment: '发布时间'
  })
  publishTime!: Date;

  @Column({
    type: 'boolean',
    default: true,
    comment: '是否有效'
  })
  isActive!: boolean;

  @CreateDateColumn({
    type: 'timestamp',
    comment: '创建时间'
  })
  createTime!: Date;

  @Column({
    type: 'varchar',
    length: 36,
    comment: '创建人ID'
  })
  createBy!: string;

  @UpdateDateColumn({
    type: 'timestamp',
    comment: '修改时间'
  })
  updateTime!: Date;

  @Column({
    type: 'varchar',
    length: 36,
    comment: '修改人ID'
  })
  updateBy!: string;
} 